package com.wlsmartlock.Fragments;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import com.wlsmartlock.R;
import com.wlsmartlock.Utils.ActivityCollector;

import com.wlsmartlock.Utils.SharedPreferencesUtils;


public class AboutFragment extends Fragment {
    SharedPreferencesUtils helper;
    private View view;
    private TextView et_userinfo;
    private Button btn_loginout;
    public AboutFragment() {
        // Required empty public constructor
    }

    public static AboutFragment newInstance() {
        AboutFragment fragment = new AboutFragment();

        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.fragment_about, container, false);

        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        helper = new SharedPreferencesUtils(getActivity(), "setting");

        et_userinfo = (TextView) view.findViewById(R.id.et_userinfo);
        btn_loginout = (Button) view.findViewById(R.id.btn_loginout);

        et_userinfo.setText(helper.getString("username"));


        btn_loginout.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View view) {
                ActivityCollector.finishAll();
            }
        });
    }



}
